package top.likeqc.leetcode.editor.cn;

/**
 * @see <a href="https://leetcode.cn/problems/number-of-unequal-triplets-in-array">2475.
 *     数组中不等三元组的数目</a>
 */
public class NumberOfUnequalTripletsInArray {
    public static void main(String[] args) {
        Solution solution = new NumberOfUnequalTripletsInArray().new Solution();
        System.out.println(solution.unequalTriplets(new int[] {4, 4, 2, 4, 3}));
        System.out.println(solution.unequalTriplets(new int[] {1, 1, 1, 1, 1}));
    }
    // leetcode submit region begin(Prohibit modification and deletion)
    class Solution {
        public int unequalTriplets(int[] nums) {
            int count = 0;
            for (int i = 0; i < nums.length; i++) {
                for (int j = i + 1; j < nums.length; j++) {
                    for (int k = j + 1; k < nums.length; k++) {
                        if (nums[i] != nums[j] && nums[i] != nums[k] && nums[j] != nums[k]) {
                            count++;
                        }
                    }
                }
            }
            return count;
        }
    }
    // leetcode submit region end(Prohibit modification and deletion)

}
